package com.sky.controller.admin;


import com.sky.dto.DishDTO;
import com.sky.result.Result;
import com.sky.service.DishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/*
菜品管理
 */
@RestController
@RequestMapping("admin/dish")
@Api(tags="菜品相关接口")
@Slf4j

public class DishController {


    @Autowired
    private DishService dishService;
    /*
    新增菜品和对应口味
     */
    @PostMapping
    @ApiOperation("新增菜品")
    public Result save(@RequestBody DishDTO dishDTO){
       log.info("新增菜品：{}",dishDTO);
       dishService.saveWithFlavor(dishDTO);
        return Result.success();

    }

}
